<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>等级兑换</title>
		<link rel="stylesheet" href="__TMPL__Public/css/normalize.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/main.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/style.css" />
	</head>
	<body>
		<!--<div class="header">
			<a onclick="goBack()" class="left-arrow"><img src="__TMPL__Public/img/arrow-b.png"></a>
			登记兑换
		</div>-->
		
		<div class="center-line-box exchange">
			<img src="__TMPL__Public/img/user/phone.png">账户余额：
				<span class="warn-f">{$user.balance}金钱</span>
		</div>
		<div class="linebg mt10">
			<volist name="grade" id="v">
				<a class="line-i ebb">
					<img class="line-icon" src="__TMPL__Public/img/user/reddimon.png">
					<span class="line-before more-w">{$v['pname']}</span>
					<span class="line-arrow">
						<if condition="$user['balance'] lt $v['pvalue'] or  $v['listorder'] elt $lo">
							<button disabled="disabled" class="exbtn warn-bg">{$v['pvalue']}金钱</button>
							<else/>
							<button data-id="{$v['id']}" class="exbtn warn-bg">{$v['pvalue']}金钱</button>
						</if>
						
					</span>
				</a>	
			</volist>
			<!--<a class="line-i">
				<img class="line-icon" src="__TMPL__Public/img/user/reddimon.png">
				<span class="line-before more-w">完美先生</span>
				<span class="line-arrow"><button class="exbtn warn-bg">100金钱</button></span>
			</a>
			<a class="line-i">
				<img class="line-icon" src="__TMPL__Public/img/user/reddimon.png">
				<span class="line-before more-w">三好先生</span>
				<span class="line-arrow"><button disabled="disabled" class="exbtn warn-bg" >1000金钱</button></span>
			</a>-->
		</div>

		
		<div class="footerbody"></div>
	</body>
	<script src="__TMPL__Public/js/main.js?{$version}"></script>
	<script src="__TMPL__Public/js/jquery-1.11.0.js"></script>
	<script type="text/javascript">
		toast.init(); 
		$(".exbtn").click(function(){
			$.post(
				"/HAction/exchange",{"id":$(this).attr("data-id")},
				function(data){
					if(data.status==1){
						toast.show("兑换成功");
						location.href="/HUser/userinfo";
					}else{
						toast.show(data.info);
					}
				}
			);
		});
	</script>
</html>
